-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Lineage metrics to FileSystems #32090
Conversation
Tested on TextIOIT: Lineage.query(SOURCE) and (SINK) both get
|
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
FQN requires segments having reserved characters (e.g. colon, dot, white space) to be wrapped with backtick. Since this is pretty common in file paths, added corresponding logic and refactor to handle them |
* Introduce metric.Lineage StringSet wrapper Reflect Java SDK apache#32090 * Direct Read * Export Read * ReadAllFromBigQuery * FILE_LOAD Write
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
@@ -624,6 +625,11 @@ protected S3ResourceId matchNewResource(String singleResourceSpec, boolean isDir | |||
return S3ResourceId.fromUri(singleResourceSpec); | |||
} | |||
|
|||
@Override | |||
protected void reportLineage(S3ResourceId resourceId, Lineage lineage) { | |||
lineage.add("s3", ImmutableList.of(resourceId.getBucket(), resourceId.getKey())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the relative path not possible here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For GCS there is a GcsPath that also handles relative path. GcsResourceId is a wrapper of it so in theory there is possibility encounter relative path, that's why I added a warning in GcsFileSystem.reportLineage.
Current codepath should never encounter relative gcs path in reportLineage as the resourceId parsed in are all matched result that was assembled from GcsPath.fromObject(storageObject)
, where storageObject comes from List API call response, which then resolved to full path.
For s3 FileSystem it's not possible. S3ResourceId stores the absolute path directly (there is no equivalent of GcsPath here). There is essentially single entrance to new an S3ResourceId object which is here:
Line 76 in 1c599d3
static S3ResourceId fromComponents(String scheme, String bucket, String key) { |
and it explicitly add a "/" in key.
sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/Lineage.java
Outdated
Show resolved
Hide resolved
...ud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageSourceBase.java
Show resolved
Hide resolved
* Add Lineage metrics to Python BigQueryIO * Introduce metric.Lineage StringSet wrapper Reflect Java SDK #32090 * Direct Read * Export Read * ReadAllFromBigQuery * FILE_LOAD Write * fix lint; add tests * Consistent metrics name * Update sdks/python/apache_beam/metrics/metric.py Co-authored-by: Danny McCormick <dannymccormick@google.com> --------- Co-authored-by: Danny McCormick <dannymccormick@google.com>
PreCommit Java known flaky test under |
This PR depends on #32068
Please add a meaningful description for your change here
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123
), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.